package com.baturu.vin.dffx.dal.dao;

import com.baturu.vin.dffx.domain.QueryImageParamDTO;
import com.baturu.vin.dffx.dto.DffxPartsImageDTO;
import com.baturu.vin.dffx.dto.DffxPartsImageInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * @Author: chenjiahao
 * @Time: 2018/10/11
 */
public interface DffxPartsImageDAO {

    @Select({"<script>SELECT ImageUrl, OrdIndex,PointX, PointY,PartSructOid,spareoid ",
            "FROM dffx_hotpoint_position",
            "WHERE (OrdIndex , PartSructOid) in ",
            "<foreach item = 'item' index = 'index' collection = 'dto' open = '(' separator = ',' close = ')'>",
            "(#{item.ordIndex},#{item.partSructOid})",
            "</foreach>",
            "</script>"})
    List<DffxPartsImageDTO> queryImage(@Param("dto") Collection<QueryImageParamDTO> queryImageParamDTOs);

    @Select({"<script>SELECT oid,name imageName,partStructOid ",
            "FROM dffx_parts_info",
            "WHERE partStructOid in ",
            "<foreach item = 'item' index = 'index' collection = 'partStructOidSet' open = '(' separator = ',' close = ')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DffxPartsImageInfoDTO> queryImageName(@Param("partStructOidSet") Collection<String> partStructOidSet);
}
